﻿using UnityEngine;
using System;

public class CubeFsmScript : MonoBehaviour
{
    public string id;

    FSMMachine<CubeFsmScript> fsmMachine = null;
    FSMState<CubeFsmScript> fsmIdle = null;

    // Use this for initialization
    void Start()
    {
        fsmMachine = new FSMMachine<CubeFsmScript>(this);
        fsmIdle = new IdleState();

        fsmMachine.ChangeState(fsmIdle);
    }

    // Excute is called once per frame
    void Update()
    {
        fsmMachine.Excute();
    }

    class IdleState : FSMState<CubeFsmScript>
    {
        public void Enter(CubeFsmScript owner)
        {
            Debug.Log("IdleState Enter.");
        }

        public void Excute(CubeFsmScript owner)
        {
            Debug.Log("IdleState Excute." + owner.id);
        }

        public void Exit(CubeFsmScript owner)
        {
            Debug.Log("IdleState Exit.");
        }
    }
}
